# https://gitee.com/yueyinqiu5990/tj12413601/blob/master/assignment4/question2/main_print_parameters.py
import torch
import torch.utils.data

import models


def main():
    print(r"|$P$|", end="")
    the_models = []
    for term_count in range(3, 6 + 1):
        model = models.MultipoleDispersionModel(term_count)
        model.load_state_dict(torch.load(f"./outputs/trained_model_{term_count}.pt"))
        the_models.append(model)
        print(rf"${term_count}$", end="|")
    print()

    print(r"|:-:|", end="")
    for _ in range(3, 6 + 1):
        print(rf":-:", end="|")
    print()

    # noinspection SpellCheckingInspection
    print(r"|$\varepsilon_\infty$|", end="")
    for model in the_models:
        print(rf"{float(model.epsilon_infinity):.3e}", end="|")
    print()

    for p in range(0, 6):
        print(rf"|$\gamma_{{0,{p + 1}}}$|", end="")
        for model in the_models:
            if len(model.terms) > p:
                term: models.MultipoleDispersionModelTerm = model.terms[p]
                print(rf"{float(term.gamma0):.3e}", end="|")
            else:
                print(rf"-", end="|")
        print()

        print(rf"|$\gamma_{{1,{p + 1}}}$|", end="")
        for model in the_models:
            if len(model.terms) > p:
                term: models.MultipoleDispersionModelTerm = model.terms[p]
                print(rf"{float(term.gamma1):.3e}", end="|")
            else:
                print(rf"-", end="|")
        print()

        print(rf"|$\delta_{{0,{p + 1}}}$|", end="")
        for model in the_models:
            if len(model.terms) > p:
                term: models.MultipoleDispersionModelTerm = model.terms[p]
                print(rf"{float(term.delta0):.3e}", end="|")
            else:
                print(rf"-", end="|")
        print()

        print(rf"|$\delta_{{1,{p + 1}}}$|", end="")
        for model in the_models:
            if len(model.terms) > p:
                term: models.MultipoleDispersionModelTerm = model.terms[p]
                print(rf"{float(term.delta1):.3e}", end="|")
            else:
                print(rf"-", end="|")
        print()

    print(r"|均方误差|", end="")
    print(f"{8.268928527832031:.3e}", end="|")
    print(f"{0.00047700488357804716:.3e}", end="|")
    print(f"{0.0004419907636474818:.3e}", end="|")
    print(f"{0.00020376920292619616:.3e}", end="|")
    print()


if __name__ == "__main__":
    main()
